﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.Json;
using System.IO;

namespace ManagementTools.Models
{
    internal class FrmPostCodeGenerateViewModel
    {
        public string SrcMainDir { get; set; }
        public string DstMainDir { get; set; }
        public string AssemblyFile { get; set; }
        public string SonTypeName { get; set; }
        public string ParentTypeName { get; set;}
        public string FkColumnName { get; set; }
        
        public void SaveToJsonFile(string fileName = "postCodeGen.his")
        {
            string json= JsonSerializer.Serialize(this,new JsonSerializerOptions { WriteIndented = true });
            File.WriteAllText(fileName,json);
        }
        public static FrmPostCodeGenerateViewModel? LoadFromJsonFile(string fileName)
        {
            string text=File.ReadAllText(fileName);
            var obj = JsonSerializer.Deserialize<FrmPostCodeGenerateViewModel>(text);
            return obj;
        }
    }
}
